package com.umgsai.wx.backend.test.sort;

import com.alibaba.fastjson.JSON;
import com.google.common.collect.Lists;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Comparator;
import java.util.List;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class Ticket {

	private Long id;

	public static void main(String[] args) {
		List<Ticket> ticketList = Lists.newArrayList();
		ticketList.add(new Ticket(1L));
		ticketList.add(new Ticket(5L));
		ticketList.add(new Ticket(2L));
		ticketList.add(new Ticket(7L));
		ticketList.add(new Ticket(6L));
		ticketList.add(new Ticket(9L));

		ticketList.sort(Comparator.comparingLong(Ticket::getId));

		System.out.println(JSON.toJSONString(ticketList));
	}
}
